[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
each(ASSOC_ARRAY)
each ASSOC_ARRAY
Returns a 2 element array consisting of the key and
value for the next value of an associative array, so
that you can iterate over it. Entries are returned
in an apparently random order. When the array is
entirely read, a null array is returned (which when
assigned produces a FALSE (0) value). The next call
to each() after that will start iterating again.
The iterator can be reset only by reading all the
elements from the array. You must not modify the
array while iterating over it. There is a single
iterator for each associative array, shared by all
each(), keys() and values() function calls in the
program. The following prints out your environment
like the printenv program, only in a different
order:
while (($key,$value) = each %ENV) {
print "$key=$value\n";
}
See Also:
keys
values
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson